home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / faq-s.zip / USEREDIT.PAS < prev    next >
Pascal/Delphi Source File  |  1990-07-28  |  12KB  |  425 lines

  1. Uses Dos,Crt;
  2.  
  3. const  maxconf=5;
  4.  
  5. type
  6.      filelisttype=(ffname,ffext,ffsize,ffpoints,ffuploaded,ffuploader,ffdown,
  7.         ffdescript,fffulnam,ffofwhat);       {Configurable file listings}
  8.      configtype=(lowercase,eightycols,linefeeds,postprompts,moreprompts,
  9.                  asciigraphics,ansigraphics,udsysop,bulletinsysop,votingsysop,
  10.                  emailsysop,doorssysop,mainsysop,databasesysop,jsysop,
  11.                  gfsysop,wanted,showtime,vt52,fseditor);
  12.      voteset=array [1..10] of byte;
  13.  
  14. type anystr=string[128];
  15.      lstr=string[80];
  16.      mstr=string[30];
  17.      sstr=string[15];
  18.  
  19.  
  20.  
  21.  
  22.  
  23. type userrec=record                         {Version 1.25}
  24.        handle,realname,note:mstr;
  25.        macro1,macro2,macro3:lstr;
  26.        password:sstr;
  27.        phonenum:string[12];
  28.        laston:longint;
  29.        numon,timetoday,nup,ndn,nbu,uploads,downloads:integer;
  30.        totaltime:real;                           {Total time spent on board}
  31.        voted:voteset;
  32.        udlevel,udpoints,level,emailannounce,beepedpwd:integer;
  33.        infoforms:array[1..5] of integer;
  34.        regularcolor,promptcolor,statcolor,inputcolor,fifthcolor,sixthcolor,
  35.        seventhcolor,eighthcolor,displaylen:byte;
  36.        lastmessages,lastups,lastgfiles,lastdbases,integer1:integer;
  37.        downk,upk:longint;
  38.        gflevel,gfuploads,gfdownloads:integer;
  39.        menutype,byte1:byte;
  40.        defproto,char1:char;
  41.        hack:byte;                                {Hack attempts}
  42.        config:set of configtype;
  43.        newscanconfig,access1,access2:set of byte;
  44.        timeinstorage:word;
  45.        lastread:array [0..20,1..maxconf] of word;
  46.        confaccess: array [0..maxconf] of boolean;
  47.        lastcps,cpstimes:word;
  48.        filelister:set of filelisttype;
  49.        commpoints,valpoints:integer;
  50.        quikconf:array[0..maxconf] of boolean;
  51.        userpcr,userudr,age:byte;
  52.        usersex:boolean;  {True=female.  Approved by Deanna Elizalda, Feminist}
  53.        voteyes,voteno:byte;
  54.        timeperday:byte;
  55.      end;
  56.  
  57.  Var
  58.     Infile         :File of Userrec;
  59.     UserRecs       :Userrec;
  60.     Place,a,b,c,d,e:Integer;
  61.     Flag           :boolean;
  62.     Choice         :Char;
  63.     Counter        :Integer;
  64.     UserNum        :Integer;
  65.  
  66.  
  67. Procedure Show_Fields;
  68. Begin
  69. TextColor(9);
  70.   Gotoxy(2,2);Write('Handle');
  71.   Gotoxy(2,3);Write('User Note');
  72.   Gotoxy(2,4);Write('Password');
  73.   Gotoxy(2,5);Write('Main Level');
  74.   Gotoxy(2,6);Write('File Level');
  75.   Gotoxy(2,7);Write('Phone Number');
  76.   Gotoxy(2,8);Write('Time Today');
  77.   Gotoxy(2,9);Write('File Points');
  78.   Gotoxy(2,10);Write('Upload K');
  79.   Gotoxy(2,11);Write('Download K');
  80.   Gotoxy(2,12);Write('Uploads');
  81.   Gotoxy(2,13);Write('Downloads');
  82.   Gotoxy(2,14);Write('Gfile Level');
  83.   Gotoxy(2,15);Write('Gfile UL''s');
  84.   Gotoxy(2,16);Write('Gfile DL''s');
  85.   Gotoxy(2,17);Write('Total Time');
  86.   Gotoxy(2,18);Write('Real Name')
  87. End;
  88.  
  89. Procedure Place_Cursor;
  90.  Begin
  91.   With Userrecs do
  92.    Begin
  93.     Case Place of
  94.     1:begin TextColor(10);Gotoxy(2,2);Write('Handle');     end;
  95.     2:begin TextColor(10);Gotoxy(2,3);Write('User Note');  end;
  96.     3:begin TextColor(10);Gotoxy(2,4);Write('Password');   end;
  97.     4:begin TextColor(10);Gotoxy(2,5);Write('Main Level'); end;
  98.     5:begin TextColor(10);Gotoxy(2,6);Write('File Level'); end;
  99.     6:begin TextColor(10);Gotoxy(2,7);Write('Phone Number');end;
  100.     7:begin TextColor(10);Gotoxy(2,8);Write('Time Today');  end;
  101.     8:begin TextColor(10);Gotoxy(2,9);Write('File Points'); end;
  102.     9:begin TextColor(10);Gotoxy(2,10);Write('Upload K');   end;
  103.    10:begin TextColor(10);Gotoxy(2,11);Write('Download K'); end;
  104.    11:begin TextColor(10);Gotoxy(2,12);Write('Uploads');    end;
  105.    12:begin TextColor(10);Gotoxy(2,13);Write('Downloads');  end;
  106.    13:begin TextColor(10);Gotoxy(2,14);Write('Gfile Level');end;
  107.    14:begin TextColor(10);Gotoxy(2,15);Write('Gfile UL''s');end;
  108.    15:Begin TextColor(10);Gotoxy(2,16);Write('Gfile DL''s');end;
  109.    16:Begin TextColor(10);Gotoxy(2,17);Write('Total Time'); end;
  110.    17:Begin TextColor(10);Gotoxy(2,18);Write('Real Name');   end
  111.   End
  112.  End
  113. End;
  114.  
  115. Procedure Read_Cursor;
  116.  Begin
  117.   With Userrecs do
  118.    Begin
  119.     Case Place of
  120.     1:begin TextColor(12);Gotoxy(16,2);Readln(Handle);      End;
  121.     2:Begin TextColor(12);Gotoxy(16,3);Readln(Note);        End;
  122.     3:Begin TextColor(12);Gotoxy(16,4);Readln(password);    End;
  123.     4:Begin TextColor(12);Gotoxy(16,5);Readln(level);       End;
  124.     5:Begin TextColor(12);Gotoxy(16,6);Readln(udlevel);     End;
  125.     6:Begin TextColor(12);Gotoxy(16,7);Readln(phonenum);    End;
  126.     7:Begin TextColor(12);Gotoxy(16,8);Readln(timetoday);   End;
  127.     8:Begin TextColor(12);Gotoxy(16,9);Readln(udpoints);    End;
  128.     9:Begin TextColor(12);Gotoxy(16,10);Readln(upk);        End;
  129.    10:Begin TextColor(12);Gotoxy(16,11);Readln(Downk);      End;
  130.    11:Begin TextColor(12);Gotoxy(16,12);Readln(uploads);    End;
  131.    12:Begin TextColor(12);Gotoxy(16,13);Readln(downloads);  End;
  132.    13:Begin TextColor(12);Gotoxy(16,14);Readln(gflevel);    End;
  133.    14:Begin TextColor(12);Gotoxy(16,15);Readln(gfuploads);  End;
  134.    15:Begin TextColor(12);Gotoxy(16,16);Readln(gfdownloads);End;
  135.    16:Begin TextColor(12);Gotoxy(16,17);Readln(totaltime);  End;
  136.    17:Begin TextColor(12);Gotoxy(16,18);Readln(realname);     End
  137.   End
  138.  End
  139. End;
  140.  
  141.  
  142. Procedure List_Rec;
  143.    Begin
  144.    TextColor(4);
  145.     Seek(infile,Usernum);
  146.     Read(Infile,Userrecs);
  147.     Gotoxy(57,15);Write('UserNumber: ',Usernum);
  148.     Textcolor(15);
  149.     With UserRecs do
  150.     Begin
  151.       Gotoxy(16,2);Write(Handle);
  152.       Gotoxy(16,3);Write(Note);
  153.       Gotoxy(16,4);Write(password);
  154.       Gotoxy(16,5);Write(level);
  155.       Gotoxy(16,6);Write(udlevel);
  156.       Gotoxy(16,7);Write(phonenum);
  157.       Gotoxy(16,8);Write(timetoday);
  158.       Gotoxy(16,9);Write(udpoints);
  159.       Gotoxy(16,10);Write(upk);
  160.       Gotoxy(16,11);Write(Downk);
  161.       Gotoxy(16,12);Write(uploads);
  162.       Gotoxy(16,13);Write(downloads);
  163.       Gotoxy(16,14);Write(gflevel);
  164.       Gotoxy(16,15);Write(gfuploads);
  165.       Gotoxy(16,16);Write(gfdownloads);
  166.       Gotoxy(16,17);Write(totaltime:6:2);
  167.       Gotoxy(16,18);Write(realname)
  168.     End
  169.    End;
  170.  
  171.  
  172. Procedure Open_Rec;
  173.     Begin
  174.       Assign(Infile,'USERS');
  175.       Reset(Infile);
  176.       Counter:=0;
  177.       While not eof (Infile) do Begin
  178.         Read(Infile,userrecs);
  179.         Counter:=Counter+1
  180.       end;
  181.       UserNum:=1
  182.     end;
  183.  
  184.  Procedure Write_Rec;
  185.  Begin
  186.    Seek(Infile,Usernum);
  187.    Write(Infile,UserRecs)
  188.  End;
  189.  
  190. Procedure Format_Data_Area;
  191.     Begin
  192.      For A:=2 to 20 do begin
  193.          GotoXy(16,A);Write('                                   ');
  194.          End;
  195.     Gotoxy(69,15);Write('   ');
  196.     Gotoxy(57,17);Write('            ');
  197.     End;
  198.  
  199. Procedure Delete_Rec;
  200.     Begin
  201.     With Userrecs do
  202.     Begin
  203.      Nbu:=0;
  204.      Handle:='';
  205.      Note:='';
  206.      Password:='';
  207.      Level:=0;
  208.      Udlevel:=0;
  209.      Phonenum:='';
  210.      TimeToday:=0;
  211.      Udpoints:=0;
  212.      Upk:=0;
  213.      Downk:=0;
  214.      Uploads:=0;
  215.      Downloads:=0;
  216.      Write_Rec;
  217.      List_Rec;
  218.      Gflevel:=0;
  219.      Gfuploads:=0;
  220.      Gfdownloads:=0;
  221.      TotalTime:=0;
  222.      Macro1:=''
  223.   end;
  224.   Write_Rec;
  225.   Format_Data_Area;
  226.   List_Rec
  227.  End;
  228.  
  229.  
  230. Procedure Add_Rec;
  231.    Begin
  232.     Usernum:=Counter;
  233.     Counter:=Counter+1;
  234.     GotoXy(57,15);Write('UserNubmer: ',Usernum);
  235.     With UserRecs do
  236.     Begin
  237.       nbu:=0;
  238.       Gotoxy(16,2);Readln(Handle);
  239.       Gotoxy(16,3);Readln(Note);
  240.       Gotoxy(16,4);Readln(password);
  241.       Gotoxy(16,5);Readln(level);
  242.       Gotoxy(16,6);Readln(udlevel);
  243.       Gotoxy(16,7);Readln(phonenum);
  244.       Gotoxy(16,8);Readln(timetoday);
  245.       Gotoxy(16,9);Readln(udpoints);
  246.       Gotoxy(16,10);Readln(upk);
  247.       Gotoxy(16,11);Readln(Downk);
  248.       Gotoxy(16,12);Readln(uploads);
  249.       Gotoxy(16,13);Readln(downloads);
  250.       Gotoxy(16,14);Readln(gflevel);
  251.       Gotoxy(16,15);Readln(gfuploads);
  252.       Gotoxy(16,16);Readln(gfdownloads);
  253.       Gotoxy(16,17);Readln(totaltime);
  254.       Gotoxy(16,18);Readln(realname)
  255.     End;
  256.     Seek(Infile,usernum);
  257.     Write(Infile,UserRecs)
  258.    End;
  259.  
  260.  
  261. Begin
  262.   ClrScr;
  263.   A:=0;
  264.   B:=0;
  265.   C:=0;
  266.   d:=0;
  267.   Flag:=False;
  268.   TextColor(11);
  269.   Gotoxy(1,1);
  270.   Write('┌────────────┐');
  271.   For A:=2 to 20 do Begin
  272.     Gotoxy(1,a);
  273.     Write('│            │')
  274.   End;
  275.   Gotoxy(1,21);
  276.   Write('└────────────┘');
  277.   TextColor(10);
  278.   Gotoxy(15,1);
  279.   Write('┌───────────────────────────────────┐');
  280.   For A:=2 to 20 do Begin
  281.     Gotoxy(15,a);
  282.     Write('│                                   │')
  283.   End;
  284.   Gotoxy(15,21);
  285.   Write('└───────────────────────────────────┘');
  286.   Show_Fields;
  287.   TextColor(14);
  288.   Gotoxy(1,22);
  289.   Write('┌');For a:=2 to 79 do Begin
  290.      Gotoxy(a,22);
  291.      Write('─')
  292.   End;
  293.   Gotoxy(80,22);
  294.   Write('┐');
  295.   TextColor(12);
  296.   Write('    [Q] Quit            [PageUp] Next User          [PageDown] Previous User');
  297.   TextColor(14);
  298.   Gotoxy(1,23);
  299.   Write('│');
  300.   Gotoxy(80,23);
  301.   Write('│');
  302.   Gotoxy(1,24);
  303.   Write('└');
  304.   For a:=2 to 79 do Begin
  305.     Gotoxy(a,24);
  306.     Write('─')
  307.   End;
  308.   Gotoxy(80,24);
  309.   Write('┘');
  310.   TextColor(11);
  311.   gotoxy(55,1);
  312.   Write('┌─────────────────┐');
  313.   For A:=2 to 10 do Begin
  314.     Gotoxy(55,a);
  315.     Write('│                 │')
  316.   End;
  317.   Gotoxy(55,10);
  318.   Write('└─────────────────┘');
  319.   TextColor(10);
  320.   Gotoxy(57,2);
  321.   Write('User Editor');
  322.   Gotoxy(57,3);
  323.   Write('Courtesy of');
  324.   Gotoxy(57,4);
  325.   Write('The TCS Folks');
  326.   Gotoxy(57,6);
  327.   Write('    v1.00 ');
  328.   TextColor(13);
  329.   Gotoxy(55,11);
  330.   Write('┌──────────────────┐');
  331.   For A:=12 to 20 do Begin
  332.     Gotoxy(55,a);
  333.     Write('│                  │')
  334.   End;
  335.   Gotoxy(55,20);
  336.   Write('└──────────────────┘');
  337.   TextColor(8);
  338.   Gotoxy(57,12);
  339.   Write('[A] Add User');
  340.   Gotoxy(57,13);
  341.   Write('[D] Delete User');
  342.   Gotoxy(57,19);
  343.   Write('[ESC] to Quit');
  344.   Open_Rec;
  345.   Format_Data_Area;
  346.   List_Rec;
  347.   Place:=1;
  348.   Place_Cursor;
  349.   While Flag=False do Begin
  350.     Choice:=Readkey;
  351.     Choice:=Upcase(Choice);
  352.     Case Choice of
  353.      'A':Begin
  354.            Format_Data_Area;
  355.            Add_Rec
  356.          End;
  357.      'D':Begin
  358.            Gotoxy(57,17);
  359.            Write('Delete User?');
  360.            Choice:=Readkey;
  361.            Choice:=Upcase(Choice);
  362.            If Choice='Y' then delete_rec else Begin
  363.              Gotoxy(57,17);
  364.              Write('             ')
  365.            End
  366.          End;
  367.      'Q':Begin
  368.            Write_Rec;
  369.            Close(Infile);
  370.            ClrScr;
  371.            Halt
  372.          End;
  373.      #27:Begin
  374.            Write_Rec;
  375.            Close(Infile);
  376.            ClrScr;
  377.            Halt
  378.          End;
  379.      #13:Read_Cursor;
  380.      #0:Begin
  381.           Choice:=Readkey;
  382.           Case Choice of
  383.            #73:Begin
  384.                  Write_Rec;
  385.                  Usernum:=Usernum+1;
  386.                  If Usernum>=counter then Usernum:=1;
  387.                  Format_Data_Area;
  388.                  List_Rec
  389.                End;
  390.            #81:Begin
  391.                  Write_Rec;
  392.                  Usernum:=Usernum-1;
  393.                  If Usernum<1 then usernum:=Counter-1;
  394.                  Format_Data_Area;
  395.                  List_Rec
  396.                End;
  397.            #72:Begin
  398.                  Place:=Place-1;
  399.                  if Place<1 then place:=19;
  400.                  Show_Fields;
  401.                  Place_Cursor
  402.                End;
  403.            #80:Begin
  404.                  Place:=Place+1;
  405.                  If Place>19 then place:=1;
  406.                  Show_Fields;
  407.                  Place_Cursor
  408.                End
  409.         End
  410.      End
  411.   End
  412. End
  413. End.
  414.  
  415.  
  416. (*   Celerity Note  --  This user editor is taken almost completely from
  417.      TCS - the interface is theirs, etc.  Credit where credit is due.
  418.      Anyway, feel free to make your own interface etc. out of this.  It should
  419.      have about all you need.  Use Turbo Pascal 5.0 or 5.5.  I am in no way
  420.      responsible for the inefficiency here.  If you do decide to write a new
  421.      user editor, please share it with the rest of us.
  422.  
  423.      *)
  424.  
  425.